home *** CD-ROM | disk | FTP | other *** search
- Subject: Re: Reading Formatted Text
- Sent: 6/11/96 2:42 PM
- Received: 6/11/96 2:51 PM
- From: Serge Froment, sfroment@odyssee.net
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- >However, I am a bit concerned about the efficiency of such a method in the
- >case the clipboard contain a large text. (I was done writing the code late
- >last evening and I have not yet tested what happen in that case.)
-
- Actually, It was way too late last evening when I wrote the code of my
- previous message. Using both FW_CTextReader and FW_CStringWriter does a
- much nicer job:
-
- void CMyData::ReadString(FW_CTextReader& textReader, FW_CString& string,
- FW_LChar delimiter)
- {
- string.Truncate(0);
- FW_Boolean seeking = true;
- FW_CStringWriter textWriter(string);
- while (seeking && textReader.GetPosition() < textReader.GetByteLength())
- {
- FW_LChar ch = textReader.PeekCharacter();
- if (ch == delimiter)
- {
- textReader.Advance();
- seeking = false;
- }
- else if (ch == '\r')
- {
- seeking = false;
- }
- else
- {
- textWriter.PutCharacterAndAdvance(ch);
- textReader.Advance();
- }
- }
- }
-
- Serge
-
-